﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CardInChina.Common.Tool
{
    public class HtmlHelper
    {
        /// <summary>
        /// 对传入的字符串做Html编码，以防止出现&,<,>,"
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static string HtmlEncode(string s)
        {
            s = s.Replace("&", "&amp;");
            s = s.Replace("<", "&lt;");
            s = s.Replace(">", "&gt;");
            s = s.Replace("\"", "&quot;");
            return s;
        }
    }
}
